#ifndef  _W5500_SET_H_
#define  _W5500_SET_H_

#include <stdint.h>
#include <stdlib.h>
#define  NETWORK_3_INI_0 system(" echo 0 > /sys/class/gpio/gpio92/value");
#define  NETWORK_3_INI_1 system(" echo 1 > /sys/class/gpio/gpio92/value");

#define  NETWORK_3_RST_1 system(" echo 0 > /sys/class/gpio/gpio93/value");
#define  NETWORK_3_RST_0 system(" echo 1 > /sys/class/gpio/gpio93/value");

#define  NETWORK_2_INI_0 system(" echo 0 > /sys/class/gpio/gpio94/value");
#define  NETWORK_2_INI_1 system(" echo 1 > /sys/class/gpio/gpio94/value");

#define  NETWORK_2_RST_1  system(" echo 0 > /sys/class/gpio/gpio95/value");
#define  NETWORK_2_RST_0  system(" echo 1 > /sys/class/gpio/gpio95/value");


#define MAX_BUF_SIZE		 				1460       			            /*定义每个数据包的大小*/
#define KEEP_ALIVE_TIME	     		30	// 30sec
#define TX_RX_MAX_BUF_SIZE      2048							 
#define EEPROM_MSG_LEN        	sizeof(EEPROM_MSG)

#define IP_FROM_DEFINE	        0       			              /*使用初始定义的IP信息*/
#define IP_FROM_DHCP	          1       			              /*使用DHCP获取IP信息*/
#define IP_FROM_EEPROM	        2       			              /*使用EEPROM定义的IP信息*/

void  NETWORK_EXport();//导出gpio节点
void reset_w5500();//复位w5500
int PHY_check(int fd);//检测网线连接
uint8_t getPHYStatus( int fd );
void	set_w5500_mac(int fd,int num);
void set_w5500_ip(int fd,int num);
void do_tcp_server(int fd,uint8_t SOCK);
void do_tcp_client(int fd,uint8_t SOCK);
extern uint8_t mac1[6];
extern uint8_t local_ip1[4];                      // 定义w5500默认IP地址
extern uint8_t subnet1[4];                          // 定义w5500默认子网掩码
extern uint8_t gateway1[4];                           // 定义w5500默认网关
extern uint8_t dns_server1[4];                    // 定义w5500默认DNS
extern uint16_t local_port;

extern uint8_t mac2[6];
extern uint8_t local_ip2[4];                      // 定义w5500默认IP地址
extern uint8_t subnet2[4];                          // 定义w5500默认子网掩码
extern uint8_t gateway2[4];                           // 定义w5500默认网关
extern uint8_t dns_server2[4];                    // 定义w5500默认DNS






extern uint8_t    remote_ip[4];                            	  /* 远端IP地址                   */
extern uint16_t   remote_port;                            	  /* 远端端口号                   */


extern uint8_t	ip_from;											                /*选择IP信息配置源*/




#endif